// 引入request
import request from '../util/request.js';
import config from '../util/config.js';
const ProcessRequest = {
    BASE_URL : config.proUrl + "/pro",
    // 请求过程在这里开发，不在.vue文件中开发
    /**
     * 多条件分页查询process列表
     * @param process
     * @param callBack
     */
    loadProcess(process, callBack){
        // 拼接url  /sys/queryByPage?xxx
        let url = this.BASE_URL + "/process/queryByPage";
        // 调用request进行请求  http://lcation
        request.get(url,process,callBack);
    },
    /**
     * 新增工序的API
     * @param process
     * @param callBack
     */
    addProcess(process,callBack){
        let url = this.BASE_URL + "/process/saveProcess"
        request.post(url,process,callBack);
    },
    /**
     * 通过id加载工序信息的API
     * @param processId
     * @param callBack
     */
    getById(processId,callBack){
        let url = this.BASE_URL + "/process/queryById?processId=" + processId;
        // let url = this.BASE_URL + "/process/queryById?processId=1";
        request.get(url,null,callBack);
    }
    ,
    /**
     * 修改工序信息的API
     * @param process
     * @param callBack
     */
    updateProcess(process,callBack){
        let url = this.BASE_URL + "/process/update";
        request.post(url,process,callBack);
    },
    /**
     *  删除工序的API
     * @param processId
     * @param callBack
     */
    deleteProcess(processId,callBack){
        request.get(this.BASE_URL + "/process/delete?processId=" + processId,null,callBack);
    },
    /**
     * 批量删除工序的API
     * @param processIds
     * @param callBack
     */
    deleteProcesses(processIds,callBack){
        let url = this.BASE_URL + "/process/deletes?processIds="+processIds;
        request.get(url,null,callBack);
    }
}
// 导出我们申明的processrequest对象
export default ProcessRequest;